#/******************************************************************************
# * CMakeLists.txt - llcoi test program CMake script
# ******************************************************************************
# * This file is part of
# *     __ __              _ 
# *    / // /_____ ____   (_)
# *   / // // ___// __ \ / / 
# *  / // // /__ / /_/ // /  
# * /_//_/ \___/ \____//_/   
# *                          
# * Low Level C Ogre Interface (llcoi)
# *
# * See http://code.google.com/p/llcoi/ for more information.
# *
# * Copyright (c) 2011, Llcoi Team
# * 
# * License: MIT
# * 
# * Permission is hereby granted, free of charge, to any person obtaining a copy
# * of this software and associated documentation files (the "Software"), to deal
# * in the Software without restriction, including without limitation the rights
# * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# * copies of the Software, and to permit persons to whom the Software is
# * furnished to do so, subject to the following conditions:
# * 
# * The above copyright notice and this permission notice shall be included in
# * all copies or substantial portions of the Software.
# * 
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# * THE SOFTWARE.
# ******************************************************************************/
cmake_minimum_required(VERSION 2.8)
 
project(OgreApp)
 
if (CMAKE_BUILD_TYPE STREQUAL "")
  # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
  # differentiation between debug and release builds.
  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
 
set(CMAKE_DEBUG_POSTFIX "_d")
 
#set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/test/dist")
 
set(SRCS
	./main.c
)

if(${LLCOI_TEST_USE_ALLEGRO})
    find_package(ALLEGRO)
    include_directories(${ALLEGRO_INCLUDE_DIR}
        ${CMAKE_SOURCE_DIR}/interface
    )
else()
	find_package(OPENINPUT)
	include_directories(
		${OPENINPUT_INCLUDE_DIR}
		${CMAKE_SOURCE_DIR}/interface
	)
endif()


add_executable(OgreApp WIN32 ${SRCS})
 
set_target_properties(OgreApp PROPERTIES DEBUG_POSTFIX _d)

if(${LLCOI_TEST_USE_ALLEGRO})
    target_link_libraries(OgreApp
        llcoi 
        ${ALLEGRO_LIBRARIES}
    )
    set_target_properties(OgreApp PROPERTIES 
        COMPILE_DEFINITIONS LLCOI_TEST_USE_ALLEGRO)
else()
	target_link_libraries(OgreApp
		llcoi 
		${OPENINPUT_LIBRARIES}
	)
    set_target_properties(OgreApp PROPERTIES 
        COMPILE_DEFINITIONS LLCOI_TEST_USE_OPENINPUT)
endif()


file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/bin)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/media)
 
# post-build copy for win32
if(WIN32 AND NOT MINGW)
	add_custom_command( TARGET OgreApp PRE_BUILD
		COMMAND if not exist .\\dist\\bin mkdir .\\dist\\bin )
	add_custom_command( TARGET OgreApp POST_BUILD
		COMMAND copy \"$(TargetPath)\" .\\dist\\bin )
endif(WIN32 AND NOT MINGW)

if(MINGW OR UNIX)
	set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/dist/bin)
endif(MINGW OR UNIX)
 
# if(WIN32)
#  
# 	install(TARGETS OgreApp
# 		RUNTIME DESTINATION bin
# 		CONFIGURATIONS All)
#  
# 	install(DIRECTORY ${CMAKE_SOURCE_DIR}/dist/Media
# 		DESTINATION ./
# 		CONFIGURATIONS Release RelWithDebInfo Debug
# 	)
#  
# 	install(FILES ${CMAKE_SOURCE_DIR}/dist/bin/plugins.cfg
# 		${CMAKE_SOURCE_DIR}/dist/bin/resources.cfg
# 		DESTINATION bin
# 		CONFIGURATIONS Release RelWithDebInfo
# 	)
#  
# 	install(FILES ${CMAKE_SOURCE_DIR}/dist/bin/plugins_d.cfg
# 		${CMAKE_SOURCE_DIR}/dist/bin/resources_d.cfg
# 		DESTINATION bin
# 		CONFIGURATIONS Debug
# 	)
#  
#         # NOTE: for the 1.7.1 sdk the OIS dll is called OIS.dll instead of libOIS.dll
#         # so you'll have to change that to make it work with 1.7.1
# 	install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
# 		${OGRE_PLUGIN_DIR_REL}/RenderSystem_Direct3D9.dll
# 		${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
# 		${OGRE_PLUGIN_DIR_REL}/libOIS.dll
# 		DESTINATION bin
# 		CONFIGURATIONS Release RelWithDebInfo
# 	)
#  
# 	install(FILES ${OGRE_PLUGIN_DIR_DBG}/OgreMain_d.dll
# 		${OGRE_PLUGIN_DIR_DBG}/RenderSystem_Direct3D9_d.dll
# 		${OGRE_PLUGIN_DIR_DBG}/RenderSystem_GL_d.dll
# 		${OGRE_PLUGIN_DIR_DBG}/libOIS_d.dll
# 		DESTINATION bin
# 		CONFIGURATIONS Debug
# 	)
#  
#    # as of sdk 1.7.2 we need to copy the boost dll's as well
#    # because they're not linked statically (it worked with 1.7.1 though)
#    install(FILES ${Boost_DATE_TIME_LIBRARY_RELEASE}
#       ${Boost_THREAD_LIBRARY_RELEASE}
#       DESTINATION bin
#       CONFIGURATIONS Release RelWithDebInfo
#    )
#  
#    install(FILES ${Boost_DATE_TIME_LIBRARY_DEBUG}
#       ${Boost_THREAD_LIBRARY_DEBUG}
#       DESTINATION bin
#       CONFIGURATIONS Debug
#    )
# endif(WIN32)

# if(UNIX)
#  
# 	install(TARGETS OgreApp
# 		RUNTIME DESTINATION bin
# 		CONFIGURATIONS All)
#  
# 	install(DIRECTORY ${CMAKE_SOURCE_DIR}/dist/media
# 		DESTINATION ./
# 		CONFIGURATIONS Release RelWithDebInfo Debug
# 	)
#  
# 	install(FILES ${CMAKE_SOURCE_DIR}/dist/bin/plugins.cfg
# 		${CMAKE_SOURCE_DIR}/dist/bin/resources.cfg
# 		DESTINATION bin
# 		CONFIGURATIONS Release RelWithDebInfo Debug
# 	)
#  
# endif(UNIX)
